<script>
    import { download } from '@/utils/request'

    export default {
        name: 'TableAction',
        inject: ['tableRoot'],
        props: {
            params: Object,
            name: String,
        },
        data() {
            return {}
        },
        methods: {
            /**
             * @name: addOnClick
             * @msg: 新增
             * @return {*}
             */
            addOnClick() {
                download(
                    '/meter/history-export',
                    {
                        ...this.params,
                    },
                    `${this.name}_${this.params.condition.startTime}至${this.params.condition.endTime}.xlsx`
                )
            },
        },
    }
</script>

<template>
    <fragment>
        <el-button size="small" @click="addOnClick" type="primary">导出</el-button>
    </fragment>
</template>
